{extend name="ashippingmanagement/Public/base" /}
{block name="container"}
     <!-- 标题 -->
    <div class="page-heade">
      <h2 class="title_color text-center">导入部门负责人</h2>
    </div>
    <!-- 标题 -->
    <table class="table table-bordered" style="margin: 0">
      <tr>
        <td><form id="f1" action="{:url('uploadfuze')}" enctype="multipart/form-data" method="post" target="target_iframe">
            选择导入文件：<input type="file" name="file" class="validate[required]" id="exampleInputFile" style="display: inline-block;"> <span class="lr_5"></span><button class="btn-info btn" type="button" onclick="go_submits()">导入</button>
            </form>
            <iframe name="target_iframe" style="display:none"></iframe>
        </td>
      </tr>
      
      <tr>
        <td>
          <p class="colorRed">温馨提示：如果导入过程中出现未满足销路通系统要求数据，则整份导入资料都将无法导入，必须按照销路通系统给出的信息提示修改导入资料后再重新导入。</p>
          <p class="padding-10 font-bold">Excel文件导入注意事项：</p>
          <p>1.请仔细阅读下面的部门导入格式。并按照注意事项填入正确的数据</p>
          <p class="padding-10">2.部门名称必须填写，且必须是系统中存在的。</p>
          <p>3.部门负责人必须填写，且必须是系统中存在的有效职员姓名。</p>
          
          <p class="padding-10"><span class="font-bold">Excel文件导入格式：</span><a href="{:url('Ashippingmanagement/downFile')}?path=/static/bm/fuzeren.xls">部门负责人导入表格格式.xls</a><span class="colorRed">注：Excel中标记为红色底色的列为必填项。</span></p>
        </td>
      </tr>
    </table>
       <script>
        //ajax提交
        function go_submits(){
           var formData = new FormData($('#f1')[0]);  
         $.ajax({    
              url: '{:url("uploadfuze")}' ,  /*这是处理文件上传的servlet*/  
              type: 'POST',    
              data: formData,   
              cache: false,    
             contentType: false,  
              processData: false,  
              success: function (re) {    
                if(re!=""){
                  var jieguo=JSON.parse(re);
                  if(jieguo["state"]==1){
                    swal({
              title: "完成",
              text:  jieguo["msg"],
              type: "success"
              },function(){
                location.href="{:url('manage')}";
              });
                  }else{
                  swal({
            title: "错误",
            text:  jieguo["msg"],
            type: "warning"
            });
                  }
                  
                }else{
                   swal({
            title: "错误",
            text:  "系统繁忙请稍后再试",
            type: "warning"
            });
                }
              },    
              error: function (re) {    
                  swal({
            title: "错误",
            text:  "系统繁忙请稍后再试",
            type: "warning"
            });
              }    
         });    
        }
           $('#form_id').validationEngine('attach', {
               promptPosition: 'bottomRight'
           });
          $(document).ready(function(){
               var $ObjectNum =$(".ObjectNum");
             toNum($ObjectNum);
          })
       </script>
{/block}